In digital cameras the image sensor typically receives the incoming light through a Bayer matrix. This matrix has red, blue and green color filters arranged so that every sensor element receives light through only one color filter. This is illustrated in the following, where R represents a sensor element receiving light through a red filter, G represents the sensor element receiving light through a green filter and B represents the sensor element receiving light through a blue filter.
            R              G              R              G              R                  G              B              G              B              G                  R              G              R              G              R                  G              B              G              B              G                  R              G              R              G              R      
There are not all three color components for every pixels in the raw camera sensor image. To produce those missing components, interpolation is used for the pixels. Typically this raw image is interpolated afterwards by a separate digital signal processing (DSP) unit or by software in order to get normal red-green-blue-image (RGB), where all the pixels have the three color components. This interpolation is called a color filter array (CFA) interpolation or demosaicing.
By interpolating the image with methods of the prior art, wrong colors can be introduced near the edges. Typical situation is when the luminance of the image changes less or more than an individual color changes. One known interpolation method is introduced in the U.S. Pat No. 5,629,734.